package com.mlnx.work.service.iml;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mlnx.common.form.PageForm;
import com.mlnx.work.dao.mysql.ProjectTaskMapper;
import com.mlnx.work.entity.ProjectTask;
import com.mlnx.work.pojo.dto.DateDTO;
import com.mlnx.work.pojo.vo.ProjectTaskListVO;
import com.mlnx.work.pojo.vo.TaskDetailVO;
import com.mlnx.work.pojo.vo.TaskListVO;
import com.mlnx.work.service.ProjectTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author name: amanda.shan
 * create time: 2020-12-28 16:58:01
 */
@Service
public class ProjectTaskServiceIml extends BaseService<ProjectTaskMapper, ProjectTask> implements ProjectTaskService {

    @Autowired
    @Override
    public void setBaseMapper(ProjectTaskMapper baseMapper) {
        super.setBaseMapper(baseMapper);
    }


    @Override
    public List<TaskListVO> getByMember(Integer memberId) {
        return baseMapper.selectTaskByMember(memberId);
    }

    @Override
    public List<TaskListVO> getByMember(Integer memberId, DateDTO dateDTO) {
        return baseMapper.selectTaskByMemberAndDate(memberId, dateDTO);
    }

    @Override
    public TaskDetailVO getParentTaskById(Integer taskId) {
        return baseMapper.selectParentTaskById(taskId);
    }

    @Override
    public List<ProjectTask> getByParentId(Integer taskId) {
        return baseMapper.selectByParentId(taskId);
    }

    @Override
    public Page<ProjectTaskListVO> getParentTaskByDirId(Integer dirId, PageForm pageForm) {
        return baseMapper.selectParentTaskByDirId(dirId, new Page<>(pageForm.getCurrent(), pageForm.getSize()));
    }

    @Override
    public List<TaskListVO> getVerifyTaskListByDept(Integer deptId) {
        return baseMapper.getVerifyTaskListByDept(deptId);
    }
}

